#!/bin/bash

#merge conditional

cd results

# merge based on:
# PERCENTAGE_MISSED
# NUMBER_MISSED
# NUMBER_TOTAL

# for each type of test result (that ends in TEST.csv
for i in `ls output.* | cut -d. -f3 | sort | uniq`
	do
	#for each test 
	echo "== $i"
	
	echo "== conditionals"
	for f in `ls output.*.$i`
		do
		# echo "$i - $f"
		predictor=`echo $f | cut -d. -f2`
		printf "%s" $predictor
		#str="conditional:"
		#res=`grep -e "$str" $f`
		#echo ${res:30} 
		grep -e "conditional:" $f | cut -d: -f2
		done >> results.conditional_output.$i
		#break

	#echo "== indirects"
	#for f in `ls output.*.$i`
	#	do
	#	# echo "$i - $f"
	#	#line=``
	#	predictor=`echo $f | cut -d. -f2`
	#	printf "%s" $predictor
	#	#str="indirect:"
	#	#res=`grep -e "$str" $f`
	#	grep -e "indirect:" $f | cut -d: -f2
	#	#echo ${res:30} 
	#	done >> results.indirect_output.$i
	#	#break


	echo "== done" ## 
	done

#PERCENTAGE

#file1=$1
#file2=$2
#pr -m -t -s\t $file1 $file2 | gawk '{print $1,$2,$5}'
